#include "EyerWASMHttpFetch_AbortEvent.hpp"

#include <emscripten.h>

extern "C"
{
EMSCRIPTEN_KEEPALIVE int EyerWASMHttpFetch_AbortEvent_Abort(void *ctx, int fetchAbortKey);

}

namespace Eyer
{
    EyerWASMHttpFetch_AbortEvent::EyerWASMHttpFetch_AbortEvent(int fetchAbortKey)
    {
        m_fetchAbortKey = fetchAbortKey;
    }

    EyerWASMHttpFetch_AbortEvent::~EyerWASMHttpFetch_AbortEvent()
    {

    }

    int EyerWASMHttpFetch_AbortEvent::Run()
    {
        std::unique_lock<std::mutex> lck(mtx);
        EyerWASMHttpFetch_AbortEvent_Abort(this, m_fetchAbortKey);
        return 0;
    }
}